package com.yunkeji.config.framework;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yunkeji.common.translation.TranslationInterface;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * 空对象配置
 *
 * @author 老张
 */
@Slf4j
@Configuration
public class EmptyObjectConfig {

    @Autowired(required = false)
    private List<TranslationInterface<?>> list;

    @Autowired private ObjectMapper objectMapper;

    /**
     *
     * @author 老张
     */
    @PostConstruct
    public void init() {
        // 返回给前端的对象,null不返回
        objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
    }
}
